import { lazy } from "react";
// 一级路由
import Home from '../path/home/Index'
import Login from '../path/login/Index'
import Error from '../path/404/Index'
import { createBrowserRouter, Navigate } from "react-router-dom";
// 二级路由
let Order=lazy(()=>import('../path/order/Index'))
let User=lazy(()=>import('../path/user/Index'))
let My=lazy(()=>import('../path/my/Index'))
let Uj=lazy(()=>import('../path/uj/Index'))
// 三级路由
let Op=lazy(()=>import('../path/user/op/Index'))
let Kl=lazy(()=>import('../path/my/kl/Index'))
// 搭建二级
export const menu_router=[
    {
        path:'/home/order',
        element:<Order></Order>,
        title:'首页'
    },
     {
        path:'/home/uj',
        element:<Uj></Uj>,
        title:'流程审批',
    },
       {
        path:'/home/my',
        element:<My></My>,
        title:'审批管理',
    },
    {
        path:'/home/my',
        element:<My></My>,
        title:'消息中心',
    },
    {
        path:'/home/user',
        element:<User></User>,
        title:'系统设置',
        children:[
            {
                path:'/home/user/op',
                element:<Op></Op>,
                title:'用户管理'
            }
        ]
    },
]
// 搭建路由一级
const routes=createBrowserRouter([
  {
    path:'/',
    element:<Navigate to={'/home'}></Navigate>
  },
  {
    path:'/home',
    element:<Home></Home>,
    children:menu_router
  },
  {
    path:'/login',
    element:<Login></Login>
  },
  {
    path:'*',
    element:<Error></Error>
  }
])
export default routes